package util;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.DataSource;

import com.alibaba.druid.pool.DruidDataSource;

public class DBUtils {

	private static DataSource source;
	
	static {
		DruidDataSource dds = new DruidDataSource();
		dds.setDriverClassName("com.mysql.cj.jdbc.Driver");
		dds.setUrl("jdbc:mysql://localhost:3306/member_db?characterEncoding=utf8&useSSL=false&serverTimezone=CST&allowPublicKeyRetrieval=true");
		dds.setUsername("root");
		dds.setPassword("123456");
		
		source = dds;
	}
	
	public static Connection getConnection() {
		try {
			return source.getConnection();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
}
